bitkeeper revision 1.1236.1.207 (424fece5IsVIZO7m8xtxHyuGSvbJCQ)
authorkaf24@viper.(none) <kaf24@viper.(none)>
Sun, 3 Apr 2005 13:17:25 +0000 (13:17 +0000)
committerkaf24@viper.(none) <kaf24@viper.(none)>
Sun, 3 Apr 2005 13:17:25 +0000 (13:17 +0000)
Fix context switching between VCPUs belonging to the same domain. Setting
and then clearing the physical CPU bit in the cpuset bitmap is incorrect.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/domain.c

index 53d1ea6e3b9a7a20c916f25e8f193385414f0757..efcc269f9b7f3b17d16e458b3cf749a3aa7aaea4 100644 (file)
@@ -808,10 +808,14 @@ static void __context_switch(void)
         }
     }
 
-    set_bit(cpu, &n->domain->cpuset);
+    if ( p->domain != n->domain )
+        set_bit(cpu, &n->domain->cpuset);
+
     write_ptbase(n);
     __asm__ __volatile__ ( "lgdt %0" : "=m" (*n->arch.gdt) );
-    clear_bit(cpu, &p->domain->cpuset);
+
+    if ( p->domain != n->domain )
+        clear_bit(cpu, &p->domain->cpuset);
 
     percpu_ctxt[cpu].curr_ed = n;
 }